package FunctionPackage;

import BookListPackage.BookList;
import BookPackage.Book;

import java.util.Scanner;

public class Add implements Function {

    @Override
    public void work(BookList bookList) {
        System.out.println("-----添加图书!-----");
        System.out.println("请输入书名:");
        Scanner scanner = new Scanner(System.in);
        String bookName = scanner.nextLine();

        System.out.println("请输入作者名:");
        String authorName = scanner.nextLine();

        System.out.println("请输入价格:");
        int price = scanner.nextInt();

        scanner.nextLine();
        System.out.println("请输入类型:");
        String type = scanner.nextLine();

        bookList.books[bookList.amount] = new Book(bookName,authorName,price,type);
        System.out.println("--------添加成功！！！--------");
        bookList.amount++;

    }
}
